home *** CD-ROM | disk | FTP | other *** search
/ Secrets of Stargate / STARGATE.iso / mac / STARGATE (5MB Macintosh) / STARGATE (5MB Macintosh).DXR / 00001_System Scripts.ls next >
Encoding:
Text File  |  1994-10-19  |  13.6 KB  |  553 lines

  1. on hiliteAnim sN, prefix
  2.   spinCursor()
  3.   set the visible of sprite 33 to 0
  4.   set the locV of sprite 33 to integer(the height of sprite sN / 2) + the locV of sprite sN
  5.   set the locH of sprite 33 to the locH of sprite sN
  6.   set the visible of sprite 33 to 1
  7.   updateStage()
  8.   wait(10)
  9.   set the visible of sprite 33 to 0
  10. end
  11.  
  12. on preRollMov sN
  13.   set the movieRate of sprite sN to 1
  14. end
  15.  
  16. on LinkToHelp
  17. end
  18.  
  19. on HideHelp
  20. end
  21.  
  22. on hiliteMe sN, hOn, hOff
  23.   spinCursor()
  24.   set sN to the clickOn
  25.   set hOn to the castNum of sprite sN
  26.   set the castNum of sprite sN to cast value(hOn - 1)
  27.   updateStage()
  28. end
  29.  
  30. on palaceCursors theOn
  31.   global gOnPC
  32.   if theOn then
  33.     preLoadCast(374, 381)
  34.     set the cursor of sprite 4 to [376, 377]
  35.     set the cursor of sprite 5 to [378, 379]
  36.     set the cursor of sprite 6 to [374, 375]
  37.     set the cursor of sprite 7 to [380, 381]
  38.     set the cursor of sprite 8 to [378, 379]
  39.   else
  40.     set the cursor of sprite 4 to 0
  41.     set the cursor of sprite 5 to 0
  42.     set the cursor of sprite 6 to 0
  43.     set the cursor of sprite 7 to 0
  44.     set the cursor of sprite 8 to 0
  45.   end if
  46.   updateStage()
  47. end
  48.  
  49. on LinkPalace thePalace
  50.   spinCursor()
  51.   set thePalace to char the number of chars in thePalace of thePalace
  52.   set thePalace to integer(thePalace)
  53.   spinCursor()
  54.   playAiff(EMPTY, EMPTY, 1)
  55.   LinkTo("P" & thePalace)
  56.   palaceCursors(1)
  57.   resetCursor()
  58. end
  59.  
  60. on keyDown theKey
  61.   global gSysVol, gMusicOn, gMusicWasOn
  62.   if voidp(theKey) or (theKey = EMPTY) then
  63.     set aK to charToNum(the key)
  64.   else
  65.     set aK to charToNum(theKey)
  66.   end if
  67.   if (aK > 47) and (aK < 56) then
  68.     if aK = 48 then
  69.       set gMusicWasOn to gMusicOn
  70.       put gMusicOn && gMusicWasOn
  71.       set gMusicOn to 0
  72.       stopAiff()
  73.       set gSysVol to 0
  74.     else
  75.       set newVol to aK - 48
  76.       set gSysVol to integer(float(255) / float(7) * newVol)
  77.       put aK && newVol && gSysVol && gMusicWasOn
  78.       if gMusicWasOn then
  79.         set gMusicOn to 1
  80.       end if
  81.     end if
  82.     set the hilite of cast "Play Music" to gMusicOn
  83.     updateVolume()
  84.   end if
  85. end
  86.  
  87. on updateVolume
  88.   global gSysVol, gOnPC
  89.   if not gOnPC then
  90.     set the volume of sound 1 to integer(gSysVol * 0.39999999999999997)
  91.     set the volume of sound 2 to integer(gSysVol * 0.39999999999999997)
  92.   end if
  93.   set range to 80
  94.   set newR to integer(float(gSysVol) / float(255.0) * float(range)) - range
  95.   set the regPoint of cast "Slider.PIC" to point(0, newR)
  96.   updateStage()
  97. end
  98.  
  99. on startMouse
  100.   startTimer()
  101. end
  102.  
  103. on debug t
  104. end
  105.  
  106. on updatePalette
  107.   global gFixPal, gOnPC
  108.   if gOnPC = 0 then
  109.     gFixPal(mPatchIt)
  110.   else
  111.     updateStage()
  112.   end if
  113. end
  114.  
  115. on loadPlayList theNum
  116.   global gPlayList, gPlayState
  117.   set gPlayState to 0
  118.   set gPlayList to field ("PLAYLIST." & theNum)
  119. end
  120.  
  121. on idle
  122.   global gMusicOn, gOnPC
  123.   if gMusicOn then
  124.     if not gOnPC then
  125.       if soundBusy(1) = 0 then
  126.         playAiff(EMPTY, 0, 1)
  127.       end if
  128.     end if
  129.   end if
  130. end
  131.  
  132. on playAiff theSound, theLoop, increment
  133.   global gMusicOn, gPlayList, gPlayState, gOnPC
  134.   if not gOnPC then
  135.     if gMusicOn = 1 then
  136.       if increment = 1 then
  137.         set gPlayState to gPlayState + 1
  138.       end if
  139.       if gPlayState > the number of lines in gPlayList then
  140.         set gPlayState to 1
  141.       end if
  142.       if increment = 1 then
  143.         set theSound to line gPlayState of gPlayList
  144.         puppetSound(theSound, 1)
  145.       end if
  146.     end if
  147.   end if
  148. end
  149.  
  150. on stopAiff
  151.   puppetSound(0)
  152. end
  153.  
  154. on hidePuppets
  155.   repeat with z = 30 to 39
  156.     set the visible of sprite z to 0
  157.   end repeat
  158. end
  159.  
  160. on showLinks
  161.   open(window "Links")
  162.   puppetPalette("System")
  163.   tell window "Links"
  164.     puppetPalette("System")
  165.     go(2)
  166.   end tell
  167. end
  168.  
  169. on startMovie
  170.   global gResourcePath, gSBState, gPSState, gPaletteTable, gMovUserViewed, gPSUserViewed, gCursID, gMarkedList, gLinkBack, gLinkBackMap, gOnPC, gStageNum, gFixPal, gMovieState, gWisdomState, gPeopleState, gIVState, gMovieStartMod, gBackDropXobj, gLastPalette, gSlideDelay, gOrigColors, gMusicOn, gMusicWasOn, gSysVol, gPlayState, gVideoDouble, gSourceRect, gPSIndivid2Flag
  171.   spinCursor()
  172.   set noQT to the quickTimePresent = 0
  173.   set gOnPC to the machineType = 256
  174.   set cdPath to the moviePath
  175.   spinCursor()
  176.   if gOnPC then
  177.     set gResourcePath to cdPath & "RESOURCE\"
  178.     set the searchPath to list(gResourcePath & "SCRNPICT\", gResourcePath & "MOOV\", gResourcePath, gResourcePath & "PEOPLE\", gResourcePath & "WISPIC\", gResourcePath & "IVPIC\", gResourcePath & "SOUND\")
  179.     if noQT then
  180.       alert("QuickTime for Windows 1.1.1 or later is required to use Secrets of STARGATE.")
  181.       quit()
  182.     end if
  183.     set gMovieStartMod to 60
  184.   else
  185.     set gResourcePath to cdPath & "RESOURCE:"
  186.     set the searchPath to list(gResourcePath & "MOOV:", gResourcePath & "SCRNPICT:", gResourcePath, gResourcePath & "PEOPLE:", gResourcePath & "WISPIC:", gResourcePath & "IVPIC:", gResourcePath & "SOUND:")
  187.     set gOrigColors to the colorDepth
  188.     if gOrigColors <> 8 then
  189.       spinCursor()
  190.       pause()
  191.       set the colorDepth to 8
  192.       unLoad(1)
  193.       preLoad(1)
  194.       updateStage()
  195.       continue()
  196.     end if
  197.     if noQT then
  198.       alert("QuickTime 1.6 or later is required to use Secrets of STARGATE.")
  199.       quit()
  200.     end if
  201.     openXLib("STARGATE:RESOURCE:POP_XOBJ")
  202.     openXLib("STARGATE:RESOURCE:QTPAL.XOJ")
  203.     set gFixPal to FixPalette(mnew, the stageLeft, the stageTop, the stageRight, the stageTop)
  204.     set gMovieStartMod to 120
  205.   end if
  206.   spinCursor()
  207.   set the stageColor to 255
  208.   set the itemDelimiter to ","
  209.   set gSBState to "1," & (the duration of cast "SB.MOV" / 60) - 1
  210.   set gIVState to 10
  211.   set gPSState to EMPTY
  212.   set gMovieState to EMPTY
  213.   set gWisdomState to EMPTY
  214.   set gPeopleState to EMPTY
  215.   set gVideoDouble to 0
  216.   updateDoubleIcon()
  217.   spinCursor()
  218.   set gSysVol to value("200")
  219.   updateVolume()
  220.   if gOnPC then
  221.     set gMusicOn to 0
  222.   else
  223.     set gMusicOn to 1
  224.   end if
  225.   set gMusicWasOn to 0
  226.   set the hilite of cast "Play Music" to gMusicOn
  227.   loadPlayList(1)
  228.   set gPlayState to 0
  229.   if not gOnPC then
  230.     set the volume of sound 1 to integer(gSysVol * 0.39999999999999997)
  231.     set the volume of sound 2 to integer(gSysVol * 0.39999999999999997)
  232.   end if
  233.   set gCursID to 1
  234.   set gStageNum to 1
  235.   set gSlideDelay to 2
  236.   set gPSUserViewed to []
  237.   set gMovUserViewed to []
  238.   set gMarkedList to []
  239.   set gLinkBack to EMPTY
  240.   set gLinkBackMap to EMPTY
  241.   set gLastPalette to EMPTY
  242.   spinCursor()
  243.   hidePuppets()
  244.   set gPaletteTable to field "Palette Table"
  245.   put " " into field "SB_Caption"
  246.   put " " into field "Matched IV"
  247.   put " " into field "Topic IV"
  248.   put " " into field "IV Caption"
  249.   spinCursor()
  250.   set gPSIndivid2Flag to 0
  251.   set the textHeight of field 824 to 16
  252.   set the textHeight of field 825 to 14
  253.   set the textHeight of field 826 to 16
  254.   createPopUps()
  255.   resetCursor()
  256. end
  257.  
  258. on updateDoubleIcon
  259.   global gVideoDouble, gResourcePath, gOnPC
  260.   if gVideoDouble = 0 then
  261.     set fName to "MOV_2X.PIC"
  262.   else
  263.     set fName to "MOV_1X.PIC"
  264.   end if
  265.   if gOnPC = 0 then
  266.     set the fileName of cast "VideoDouble" to "STARGATE:RESOURCE:SCRNPICT:" & fName
  267.   else
  268.     set the fileName of cast "VideoDouble" to gResourcePath & "SCRNPICT/" & fName
  269.   end if
  270.   set the hilite of cast "Double Sized Video" to gVideoDouble
  271. end
  272.  
  273. on stopMovie
  274.   global gOrigColors
  275.   if gOrigColors <> the colorDepth then
  276.     spinCursor()
  277.     set the colorDepth to gOrigColors
  278.     updateStage()
  279.   end if
  280. end
  281.  
  282. on readPrefs
  283.   global gResourcePath, gMarkedList, gReadObj, gOnPC, gVideoDouble, gSysVol, gMusicOn, gMusicWasOn
  284.   spinCursor()
  285.   if gOnPC = 1 then
  286.     set gReadObj to FileIO(mnew, "?read", "SGP")
  287.   else
  288.     set gReadObj to FileIO(mnew, "?read", "TEXT")
  289.   end if
  290.   spinCursor()
  291.   if gReadObj = -43 then
  292.     exit
  293.   else
  294.     set allText to gReadObj(mReadFile)
  295.     gReadObj(mdispose)
  296.     set gMusicWasOn to 0
  297.     set vInfo to line 1 of allText
  298.     set newMarked to line 2 of allText
  299.     set gVideoDouble to line 3 of allText
  300.     set gSysVol to line 4 of allText
  301.     set gMusicOn to line 5 of allText
  302.     set gMarkedList to value(string(newMarked))
  303.     updateDoubleIcon()
  304.   end if
  305.   resetCursor()
  306. end
  307.  
  308. on writePrefs
  309.   global gResourcePath, gMarkedList, gWriteObj, gOnPC, gVideoDouble, gSysVol, gMusicOn
  310.   spinCursor()
  311.   if gOnPC = 1 then
  312.     set gWriteObj to FileIO(mnew, "?write", "SGCDPREF.SGP")
  313.   else
  314.     set gWriteObj to FileIO(mnew, "?write", "SG User Prefs")
  315.   end if
  316.   if gWriteObj = -43 then
  317.     exit
  318.   else
  319.     spinCursor()
  320.     set allText to "StarGate CD " & the date && the time & RETURN & value(string(gMarkedList)) & RETURN & gVideoDouble & RETURN & gSysVol & RETURN & gMusicOn
  321.     gWriteObj(mWriteString, allText)
  322.     spinCursor()
  323.     gWriteObj(mdispose)
  324.   end if
  325.   resetCursor()
  326. end
  327.  
  328. on LineOffset f, t
  329.   set t to RETURN & t & RETURN
  330.   set o to offset(RETURN & f & RETURN, t)
  331.   if o > 0 then
  332.     return the number of lines in char 1 to o of t - 1
  333.   else
  334.     return "0"
  335.   end if
  336. end
  337.  
  338. on ItemOffset f, t
  339.   set t to "," & t & ","
  340.   set o to offset("," & f & ",", t)
  341.   if o > 0 then
  342.     return the number of items in char 1 to o of t - 1
  343.   else
  344.     return "0"
  345.   end if
  346. end
  347.  
  348. on LineItemOffset f, t
  349.   set t to RETURN & t & ","
  350.   set o to offset(RETURN & f & ",", t)
  351.   if o > 0 then
  352.     return the number of lines in char 1 to o of t - 1
  353.   else
  354.     return "0"
  355.   end if
  356. end
  357.  
  358. on wait theTicks
  359.   startTimer()
  360.   repeat while the timer < theTicks
  361.   end repeat
  362. end
  363.  
  364. on underDev
  365. end
  366.  
  367. on dissolveEffect
  368.   global gOnPC
  369.   if gOnPC = 0 then
  370.     puppetTransition(50, 0, 20)
  371.   end if
  372. end
  373.  
  374. on LinkTo theDest, theEffect, custPal
  375.   global gPaletteTable, gOnPC
  376.   spinCursor()
  377.   debug(EMPTY)
  378.   hidePuppets()
  379.   spinCursor()
  380.   set the cursor of sprite 4 to 0
  381.   set the cursor of sprite 5 to 0
  382.   set the cursor of sprite 6 to 0
  383.   set the cursor of sprite 7 to 0
  384.   set the cursor of sprite 8 to 0
  385.   set thisFrame to the frame
  386.   if (theDest = EMPTY) or voidp(theDest) then
  387.     set theDest to "Start2"
  388.   end if
  389.   set destFrame to label(theDest)
  390.   set thisPal to line thisFrame of gPaletteTable
  391.   if (custPal = EMPTY) or voidp(custPal) then
  392.     set destPal to line destFrame of gPaletteTable
  393.   else
  394.     set destPal to the number of cast custPal
  395.   end if
  396.   if thisPal <> destPal then
  397.     dissolveEffect()
  398.     puppetPalette(the framePalette)
  399.     spinCursor()
  400.     go("Black")
  401.     spinCursor()
  402.     if (destPal = EMPTY) or (destPal = 0) then
  403.       puppetPalette("System")
  404.     else
  405.       if integerp(value(destPal)) then
  406.         puppetPalette(value(destPal))
  407.       else
  408.         puppetPalette(destPal)
  409.       end if
  410.     end if
  411.     updateStage()
  412.     puppetPalette(0)
  413.     spinCursor()
  414.   end if
  415.   set the visible of sprite 4 to 1
  416.   dissolveEffect()
  417.   spinCursor()
  418.   set the visible of sprite 31 to 0
  419.   if gOnPC then
  420.     spinCursor()
  421.     unLoad()
  422.   end if
  423.   go(destFrame)
  424.   updatePalette()
  425.   spinCursor()
  426.   resetCursor()
  427.   startMouse()
  428. end
  429.  
  430. on spinCursor
  431.   global gCursID
  432.   set gCursID to (gCursID + 1) mod 8
  433.   cursor(list(the number of cast ("Watch" & gCursID + 1), the number of cast "Watch Mask"))
  434. end
  435.  
  436. on putBackChars str
  437.   set b to the itemDelimiter
  438.   set the itemDelimiter to "~"
  439.   set l to item 1 of str
  440.   repeat with z = 2 to the number of items in str
  441.     put RETURN & item z of str after l
  442.   end repeat
  443.   set the itemDelimiter to b
  444.   return l
  445. end
  446.  
  447. on resetCursor
  448.   cursor(-1)
  449. end
  450.  
  451. on stopCursor
  452.   cursor(list(the number of cast "Stop Cursor", the number of cast "Stop Cursor Mask"))
  453. end
  454.  
  455. on waitUntilClick
  456.   repeat while the mouseUp = 1
  457.   end repeat
  458. end
  459.  
  460. on eatDBLClick
  461.   repeat while the mouseUp = 0
  462.   end repeat
  463. end
  464.  
  465. on createPopUps
  466.   global xObjSBPop, gOnPC
  467.   if gOnPC = 0 then
  468.     if objectp(xObjSBPop) then
  469.       xObjSBPop(mdispose)
  470.     end if
  471.     set menuList to the text of cast "SBTXT_PU"
  472.     set xObjSBPop to PopMenu(mnew, menuList, 200)
  473.     if not objectp(xObjSBPop) then
  474.       devAlert("SB PopMenu object not made: " & string(xObjSBPop))
  475.     end if
  476.   end if
  477. end
  478.  
  479. on createPeoplePopUps theItem
  480.   global xObjPeoplePop, gPeoplePopRecs, gPeoplePop1, gOnPC
  481.   if gOnPC = 0 then
  482.     if objectp(xObjPeoplePop) then
  483.       xObjPeoplePop(mdispose)
  484.     end if
  485.     set b to the itemDelimiter
  486.     set the itemDelimiter to "|"
  487.     set gPeoplePop1 to item theItem of field "PEOPLE_P1"
  488.     put item theItem of field "PEOPLE_P3", gPeoplePopRecs
  489.     set the itemDelimiter to b
  490.     set xObjPeoplePop to PopMenu(mnew, gPeoplePop1, 201)
  491.     if not objectp(xObjPeoplePop) then
  492.       devAlert("People PopMenu object not made: " & string(xObjPeoplePop))
  493.     end if
  494.   end if
  495. end
  496.  
  497. on invokePeoplePopUp
  498.   global xObjPeoplePop, gPeoplePopRecs, gPeoplePop1, gOnPC
  499.   if gOnPC = 0 then
  500.     set s to the clickOn
  501.     set sx to the left of sprite s + the stageLeft + 1
  502.     set sy to the top of sprite s + the stageTop + 1
  503.     set result to xObjPeoplePop(mPopText, sx, sy, 0)
  504.     spinCursor()
  505.     if string(result) = EMPTY then
  506.       resetCursor()
  507.       exit
  508.     else
  509.       set l to LineOffset(result, gPeoplePop1)
  510.       if l > 0 then
  511.         LinkPeopleFromIcon(l)
  512.       else
  513.         devAlert("People ‚Äú" & result & "‚Äù not found in lookUp table.")
  514.       end if
  515.       resetCursor()
  516.     end if
  517.   end if
  518. end
  519.  
  520. on invokeSBPopUp
  521.   global xObjSBPop, gOnPC
  522.   if gOnPC = 0 then
  523.     set s to the clickOn
  524.     set sx to the left of sprite s + the stageLeft + 1
  525.     set sy to the top of sprite s + the stageTop + 1
  526.     set result to xObjSBPop(mPopText, sx, sy, 0)
  527.     spinCursor()
  528.     if string(result) = EMPTY then
  529.       resetCursor()
  530.       exit
  531.     else
  532.       set l to LineOffset(result, field "SBTXT_PU")
  533.       if l > 0 then
  534.         updateSB(line l of field "SBTXT_PD")
  535.         resetCursor()
  536.       else
  537.         devAlert("Storyboard ‚Äú" & result & "‚Äù not found in lookUp table.")
  538.       end if
  539.     end if
  540.   end if
  541. end
  542.  
  543. on clickLineTest
  544.   set c to the clickOn
  545.   set v to the mouseV
  546.   set t to the top of sprite c
  547.   set theNum to the castNum of sprite c
  548.   set h to the textHeight of field theNum
  549.   set d to v - t
  550.   set c to integer(d / h) + 1
  551.   LinkStageFromLine(c)
  552. end
  553.